<?php
/* @var $this yii\web\View */
/* @var $model \common\models\Check */
use yii\helpers\Url;
$this->title = '特尊医疗管理后台';
?>
    <section class="app-page-section">
    
	   	<section class="app-container app-member app-admin">
        
            <div class="app-admin-buy-list app-admin-buy-detail">

                <div class="app-admin-buy-item">
                    <div class="clearfix">
                        <strong class="name pull-left"><?= $model->user->username ?></strong>
                        <?php
                        if( $model->times === 3 ){
                            ?>
                            <span class="status status-success pull-right">已通过</span>
                            <?php
                        }elseif( $model->times === -1 ){
                            ?>
                            <span class="status status-fail pull-right">未通过</span>
                            <?php
                        } else{
        
                            ?>
                            <span class="status status-warring pull-right">审核中</span>
                            <?php
                        }
                        ?>
                    </div>
                    <div class="clearfix">
                        <span class="tel pull-left"><?= $model->user->mobile ?></span>
                        <span class="time pull-right"><?= date('Y-m-d H:i:s', $model->created_at) ?></span>
                    </div>
                    <div class="app-admin-buy-control text-right">
                        <a href="<?= Url::toRoute(['manage/check-log', 'id' => $model->id]) ?>">审核记录</a>
                        <a href="<?= Url::toRoute(['manage/do-check', 'id' => $model->id]) ?>">提交审核</a>
                    </div>
                </div>

            </div>

            <div class="app-admin-buy-photo">
                <ul>
                    <?php
                    foreach($model->files as $k => $file){
                        ?>
                        <li class="images"><img src="<?= $file->file_path ?>" alt=""></li>
                        <?php
                    }
                    ?>
                </ul>
            </div>

        </section>

    </section>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
    <?php
    if( Yii::$app->wechat->isWechat ){
    ?>
    wx.config(<?= $wxConfig ?>);
    wx.ready(function (){
        document.querySelector('.images').onclick = function (){
            var url = "<?= Yii::$app->request->getHostInfo() ?>";
            var img = this.firstChild.getAttribute('src');
            wx.previewImage({
                current:  url + img,
                urls: [
                    <?php
                    $files = '';
                    foreach( $model->files as $k => $file ){
                        $files .= '"'. Yii::$app->request->getHostInfo() . $file->file_path . '",';
                    }
                    echo $files;
                    ?>
                ]
            });
        };
    });
    <?php
    }
    ?>
</script>
